//
//  BaseTableViewController.swift
//  weibo
//
//  Created by 谭仁川 on 15/11/27.
//  Copyright © 2015年 itcast. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {


    var userLogin = UserAccountViewModel().userLogin
    var visitorLoginView : VisitorLoginView?
    override func loadView() {
        
        userLogin ? super.loadView() : setVisitorView()
    
    }
    private func setVisitorView(){
        
        visitorLoginView = VisitorLoginView()
        visitorLoginView?.visitorViewDelegate = self
        view = visitorLoginView
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userWilllogin")
         navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
        
        
    }
    func userWilllogin() {
        print(__FUNCTION__)
        let oauth = OAuthViewController()
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)
    }
    func userWillRegister() {
        print(__FUNCTION__)
    }
    
 
}
